package co.msk8.server.action.commands;

import co.msk8.client.command.action.SubAction;
import co.msk8.client.command.result.SubResult;
import co.msk8.server.action.ActionHandler;
import co.msk8.server.calculator.Calculator;
import co.msk8.server.calculator.CalculatorFactory;
import co.msk8.server.calculator.CalculatorFactory.CalculatorType;

public class SubCommand implements ActionHandler<SubAction, SubResult> {
	
	Calculator calculator = CalculatorFactory.createCalculator(CalculatorType.SIMPLE);

	public Class<SubAction> getActionType() {
		return SubAction.class;
	}

	public SubResult execute(SubAction action) throws Exception {
		
		
		SubResult result = new SubResult(calculator.getSustraction(action.getA(), action.getB()));
		return result;
	}

}
